<?php
//Ajout du fichier regroupant chacune des fonctions
include "sys/Kernel.amv.php";
$main = new main();
if(isset($_COOKIE["cuser"]) AND isset($_COOKIE["csess"]) AND $main->validSession($_COOKIE["cuser"], $_COOKIE["csess"]) === true)
{
	define("Online", true, true);
	define("User", $_COOKIE["cuser"], true);
	define("Sess", $_COOKIE["csess"], true);
	define("accesLv", $main->getAccesLevel(User), true);
}
elseif(isset($_SESSION["suser"]) AND isset($_SESSION["ssess"]) AND $main->validSession($_SESSION["suser"], $_SESSION["ssess"]) === true)
{
	define("Online", true, true);
	define("User", $_SESSION["suser"], true);
	define("Sess", $_SESSION["ssess"], true);
	define("accesLv", $main->getAccesLevel(User), true);
}
else
{
	define("Online", false, true);
	define("User", "Guest", true);
	define("accesLv", 0, true);
}
?>
<!DOCTYPE html>
<html lang="fr">
	<head>
		<meta charset="utf-8" />
		<title>Association Mendoise Volleyball</title>
		<script src="inc/js/jquery111.js"></script>
		<script src="inc/js/responsive.js"></script>
		<link rel="stylesheet" href="inc/css/Index.css">
		<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'>
		<!-- Plugins -->
			<!-- JBox -->
			<script src="inc/js/jbox/jbox.min.js"></script>
			<link rel="stylesheet" href="inc/css/jbox/jbox.css">
			<!-- End of JBox -->
			
		<!-- End of Plugins -->
		<?php
		if(isset($_GET[pageVar]) AND file_exists("p/".$_GET[pageVar].".amv.php"))
		{
			$pageVar = $_GET[pageVar];
			echo '<link rel="stylesheet" href="inc/css/'.$pageVar.'.css">';
		}
		else
		{
			$pageVar = "Accueil";
			echo '<link rel="stylesheet" href="inc/css/Accueil.css">';
		}
		?>
	</head>
	<body>
<?php
include "inc/Menu.amv.php";
if(file_exists("p/".$pageVar.".amv.php"))
{
	include "p/".$pageVar.".amv.php";
}
else
{
	include "p/Accueil.amv.php";
}

if(!Online)
{
	?>
	<script src="inc/js/Connexion.js"></script>
	<?php
}
?>
	</body>
</html>